#!/usr/bin/env bash

testsuite="$1"

while read -r dummy functional system nspin quantity result; do
    type=$(echo $functional | sed 's/\(.*_\(x\|c\|k\|xc\)\)_.*/\1/')
    if [ $nspin == "1" ]; then
        sspin="unpol"
    else
        sspin="pol"
    fi

    if [ $quantity == "exc" ]; then
        squantity="0"
    elif [ $quantity == "vxc" ]; then
        squantity="1"
    else
        squantity="2"
    fi

    fname="$functional.$system.$sspin.$squantity.bz2"

    if [ -f regression/$type/$fname ]; then
      echo "Disabling " $fname
      git mv regression/$type/$fname regression/$type/disabled/$fname
    else
      echo "Could not find" $fname
    fi
done < <(grep " \* " $testsuite | grep -v "OK")
